<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        <button @click='btnClick'>点击</button>
    </div>
    <template id='cpn'>
        <div>子组件</div>
    </template>
    <script>
        new Vue({
            el:'#app',
            methods:{
                btnClick(){
                    console.log(this.$children)
                }
            },
            components:{
                cpn:{
                    template:'#cpn',
                    data(){
                        return{
                            msg:'子组件'
                        }
                    },
                    methods:{
                        showMessage(){
                            console.log('showMassage');
                        }
                    }
                }
            }
        })
    </script>
</body>
</html>